# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# File: $Id: base.py 24 2007-12-18 11:48:29Z mingli.yuan $
# Revision: $Revision: 24 $
#----------------------------------------------------------------------------
# py-jasmine: A python GUI tool for pdf journal making
# Copyright (C) 2007  Mingli Yuan
#
# This program is a part of py-jasmine.
#
# py-jasmine is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# py-jasmine is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with py-jasmine. If not, see <http://www.gnu.org/licenses/>.
#
# This software consists of voluntary contributions made by many
# individuals. For the exact contribution history, see the revision
# history and logs, available at http://py-jasmine.googlecode.com/svn/trunk/.
#
#----------------------------------------------------------------------------

"""base class for data representation in py-jasmine
@version: $Id: base.py 24 2007-12-18 11:48:29Z mingli.yuan $
@author: Mingli Yuan <me@mingli-yuan.info>
@license: gpl
"""

__version__ = "$Revision: 24 $"


import os.path
import yaml

class Base():
    """The base class for models for py-jasmine books."""

    def __init__(self, base_path):
        self.base_path = base_path
        self.model_file = os.path.join(base_path, "model.yml")
        stream = file(self.model_file, 'r')
        self.data = yaml.load(stream)

    def get(self, name):
        return self.data[name]

